import Vue from 'vue'
import Router, { Route } from 'vue-router'
import App from '../../App.vue'
import store from '@/store';
import {
    Dialog,
    Popup,
    Tabbar,
    TabbarItem,
} from 'vant';
import { MobileButton } from '@forzoom/mobile-button';
import { currency } from '@/lib/utils';
import VueRouter from 'vue-router';
import extendVue from '@/lib/extendVue';

Vue.use(Router)
Vue.component('MobileButton', MobileButton);
Vue.component(Dialog.Component.name, Dialog.Component);
Vue.component(Popup.name, Popup);
Vue.component(Tabbar.name, Tabbar);
Vue.component(TabbarItem.name, TabbarItem);
Vue.filter('currency', currency);
extendVue();

const router = new VueRouter({
    routes: [
        {
            path: '/',
            beforeEnter: (to: Route, from: Route, next: any) => {
                // console.log('target19', getCurrentPages());
            },
        },
    ],
});

export default function createApp() {
    const container = document.createElement('div');
    container.id = 'app';
    document.body.appendChild(container);

    Vue.config.productionTip = false;

    return new Vue({
        el: '#app',
        router,
        store,
        render: h => h(App)
    });
}
